import { IncomingHttpHeaders } from 'http';

import query from '@dfeidao/atom-nodejs/db/query';
import {  productid,systemid } from '../../atom/config';
interface Message {
	filter: {
		exam_id: string[]
	};
	// cookie: {
	// 	uk: string;
	// 	[key: string]: string
	// };
	// urls: {
	// 	base: string;
	// 	origin: string;
	// 	url: string;
	// };
	// query: {};
	// params: {};
	// headers: {};
	// captcha: string;
}

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const { prepare, exec } = query(action_id, session_id, systemid);
	prepare('exam_paper', ['exam_id', 'exam_score', 'exam_time'],
		{
			productid, exam_id: { $in: message.filter.exam_id }
		}, 200, 1, [], []);
	const [dt] = await exec();
	return { dt };
}
